<ContentControl x:Class="ApiScannerShell.ScannerConfigurationSectionView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ApiScannerShell="clr-namespace:ApiScannerShell" xmlns:ViewModels="clr-namespace:ApiScannerShell.ViewModels" x:Name="Root">
	<Grid DataContext="{Binding ViewModel,ElementName=Root}">
		<Grid.Resources>
			<DataTemplate x:Key="TestTemplate">
				<Grid>
					<Grid.RowDefinitions>
						<RowDefinition Height="*" />
						<RowDefinition Height="Auto" />
					</Grid.RowDefinitions>
					<WrapPanel Orientation="Vertical" Grid.Row="1">
                        <TextBlock Style="{StaticResource Heading}" Text="{Binding DisplayName}" />
                        <TextBlock Style="{StaticResource Text}" Text="{Binding Description}" />
                        <TextBlock>
                            <Run Text="This test is currently" />
                            <Run Style="{StaticResource Value}" Text="enabled" />
                            <Run Text="." />
                            <TextBlock.Style>
                                <Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource Text}">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding IsEnabled}" Value="True">
                                            <Setter Property="Visibility" Value="Visible" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBlock.Style>
                        </TextBlock>
                        <TextBlock>
                            <Run Text="This test is currently" />
                            <Run Style="{StaticResource Value}" Text="disabled" />
                            <Run Text="." />
                            <TextBlock.Style>
                                <Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource Text}">
                                    <Setter Property="Visibility" Value="Visible" />
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding IsEnabled}" Value="True">
                                            <Setter Property="Visibility" Value="Collapsed" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBlock.Style>
                        </TextBlock>
                        <TextBlock Style="{StaticResource Text}">
							<Hyperlink Command="{Binding ConfigureTestCommand}">
								<Run Text="Configure this test" />
							</Hyperlink>
                            <Run Text="  " />
                            <Hyperlink Command="{Binding RemoveTestCommand}">
								<Run Text="Remove this test" />
							</Hyperlink>
						</TextBlock>
                        
					</WrapPanel>
				</Grid>
			</DataTemplate>
		</Grid.Resources>
		<Grid.RowDefinitions>
			<RowDefinition Height="*" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>
		<ScrollViewer HorizontalScrollBarVisibility="Hidden">
			<ItemsControl ItemsSource="{Binding Tests}" ItemTemplate="{StaticResource TestTemplate}" />
            <ScrollViewer.Style>
                <Style TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource {x:Type ScrollViewer}}">
                    <Setter Property="Visibility" Value="Visible" />
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Tests.Count}" Value="0">
                            <Setter Property="Visibility" Value="Collapsed" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </ScrollViewer.Style>
		</ScrollViewer>
        <StackPanel>
            <TextBlock Style="{StaticResource Heading}">
                <Run Text="Empty configuration" />
            </TextBlock>
            <TextBlock Style="{StaticResource SubHeading}">
                <Run Text="This configuration file currently has no tests associated with it. To add a test, click on one of the hyperlinks in the action pane below." />
            </TextBlock>
            <StackPanel.Style>
                <Style TargetType="{x:Type StackPanel}">
                    <Setter Property="Visibility" Value="Collapsed" />
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Tests.Count}" Value="0">
                            <Setter Property="Visibility" Value="Visible" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </StackPanel.Style>
        </StackPanel>
        <WrapPanel Grid.Row="1" Orientation="Horizontal" Style="{StaticResource FooterPanel}">
			<WrapPanel.Resources>
				<DataTemplate DataType="{x:Type ApiScannerShell:NamedDelegateCommand}">
					<TextBlock Style="{StaticResource Text}">
						<Hyperlink Command="{Binding}">
							<Run Text="Create " />
							<TextBlock Text="{Binding Name}" />
						</Hyperlink>
					</TextBlock>
				</DataTemplate>
			</WrapPanel.Resources>
			<TextBlock Style="{StaticResource Text}" Text="Actions: " />

            <ItemsControl ItemsSource="{Binding CreateTestActionCommands}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel Orientation="Horizontal" />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
            </ItemsControl>
        </WrapPanel>
	</Grid>
</ContentControl>